package me.zhengjie.modules.system.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

/**
 * 场景风险案例表
 *
 * @author wj
 * @version 1.0.0
 * @since 1.0.0
 */
@Entity
@Getter
@Setter
@Table(name = "st_safe_risk_case")
public class SafeRiskCase extends BaseEntity implements Serializable {

    @Id
    @NotNull(groups = Update.class)
    @ApiModelProperty(value = "ID", hidden = true)
    @GeneratedValue(generator = "case_uuid")
    @GenericGenerator(name = "case_uuid", strategy = "uuid")
    @Column(name = "id", length = 32, unique = true, nullable = false)
    private String id;

    @NotBlank
    @ApiModelProperty(value = "场景类型0:业务 1:功能")
    private String sceneType;

    @ExcelProperty( "案例编号")
    @ApiModelProperty(value = "案例编号")
    private String caseId;

    @ExcelProperty("案例名称")
    @ApiModelProperty(value = "案例名称")
    private String caseName;

    @ExcelProperty("测试目的\n" +
            "（意图）")
    @ApiModelProperty(value = "测试目的")
    private String testPurpose;

    @ExcelProperty("测试条件\n" +
            "(数据需求）")
    @ApiModelProperty(value = "测试条件")
    private String testConditions;

    @ExcelProperty("测试方法")
    @ApiModelProperty(value = "测试方法")
    private String testMethod;

    @ExcelProperty("测试场景")
    @ApiModelProperty(value = "测试场景")
    private String testScenario;

    @ExcelProperty("测试步骤")
    @ApiModelProperty(value = "测试步骤")
    private String testProcedure;

    @ExcelProperty("检查指引")
    @ApiModelProperty(value = "检查指引")
    private String inspectGuide;

    @ExcelProperty("期望结果")
    @ApiModelProperty(value = "期望结果")
    private String expectResult;

    @ExcelProperty("测试结果")
    @ApiModelProperty(value = "测试结果")
    private String testResult;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SafeRiskCase that = (SafeRiskCase) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(sceneType, that.sceneType) &&
                Objects.equals(caseId, that.caseId) &&
                Objects.equals(caseName, that.caseName) &&
                Objects.equals(testPurpose, that.testPurpose) &&
                Objects.equals(testConditions, that.testConditions) &&
                Objects.equals(testMethod, that.testMethod) &&
                Objects.equals(testScenario, that.testScenario) &&
                Objects.equals(testProcedure, that.testProcedure) &&
                Objects.equals(inspectGuide, that.inspectGuide) &&
                Objects.equals(expectResult, that.expectResult) &&
                Objects.equals(testResult, that.testResult);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, sceneType, caseId, caseName, testPurpose, testConditions, testMethod, testScenario, testProcedure, inspectGuide, expectResult, testResult);
    }
}
